<template>
  <div>
    父组件
    <br />
    <hr />
    <Son :data="goodMans">
      <template slot-scope="scope">
        <span :style="{ color: scope.row.tag === '家' ? 'blue' : 'green' }">{{
          scope.row.tag
        }}</span>
      </template>
    </Son>
    <br />
    <br />
    <br />
    <Son :data="goodMans">
      <template #default="scope">
        <span :style="{ color: scope.row.tag === '家' ? 'red' : 'purple' }">{{
          scope.row.tag
        }}</span>
      </template>
    </Son>
  </div>
</template>
<script>
import Son from './son'
export default {
  components: {
    Son
  },
  data () {
    return {
      goodMans: [
        { id: 1001, name: '令狐冲', address: '华山', tag: '公司' },
        { id: 1002, name: '康熙', address: '紫禁城', tag: '家' },
        { id: 1003, name: '杨过', address: '古墓', tag: '家' },
        { id: 1004, name: '郭靖', address: '襄阳', tag: '公司' }
      ]
    }
  }
}
</script>
<style></style>
